# 作者: 郑驭泷
# 2025年03月23日23时24分09秒
# 2395042511@qq.com
import re

name_list = ["name", "2nmae", "_nsjd"]
for name in name_list:
    Ret = re.match(r"[a-zA-Z_]\w*", name)
    if Ret:
        print(f"{Ret.group()}符合命名规范")
    else:
        print(f"{name}不符合命名规范")
ret = re.match(r"[1-9]?\d$|100$", "100")
print(ret.group())


def find_second_match(pattern, text):
    matches = re.finditer(pattern, text)
    try:
        next(matches)  # 跳过第一个匹配项
        second_match = next(matches)  # 获取第二个匹配项
        return second_match.group()
    except StopIteration:
        return None
    # 示例用法


text = "abc123def456ghi789"
pattern = r"\d+"
second_match = find_second_match(pattern, text)
print(second_match)
